Re: plperl doesn't release memory

Поиск
Список
Период
Сортировка
От Dan Sugalski
Тема Re: plperl doesn't release memory
Дата
Msg-id a06210200be6a0777423d@[192.168.0.8]
обсуждение исходный текст
Ответ на Re: plperl doesn't release memory  (Greg Stark <gsstark@mit.edu>)
Список pgsql-general
At 6:58 PM -0500 3/24/05, Greg Stark wrote:
>Dan Sugalski <dan@sidhe.org> writes:
>
>>  Anyway, if perl's using its own memory allocator you'll want to rebuild it
>>  to not do that.
>
>You would need to do that if you wanted to use a debugging malloc. But there's
>no particular reason to think that you should need to do this just to work
>properly.
>
>Two mallocs can work fine alongside each other. They each call mmap or sbrk to
>allocate new pages and they each manage the pages they've received. They won't
>have any idea why the allocator seems to be skipping pages, but they should be
>careful not to touch those pages.

Perl will only use a single allocator, so there's not a huge issue
there. It's either the external allocator or the internal one, which
is for the best since you certainly don't want to be handing back
memory to the wrong allocator. That way lies madness and unpleasant
core files.

The bigger issue is that perl's memory allocation system, the one you
get if you build perl with usemymalloc set to yes, never releases
memory back to the system -- once the internal allocator gets a chunk
of memory from the system it's held for the duration of the process.
This is the right answer in many circumstances, and the allocator's
pretty nicely tuned to perl's normal allocation patterns, it's just
not really the right thing in a persistent server situation where
memory usage bounces up and down. It can happen with the system
allocator too, though it's less likely.

One of those engineering tradeoff things, and not much to be done
about it really.
--
                Dan

--------------------------------------it's like this-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk

В списке pgsql-general по дате отправления:

Предыдущее
От: Steve Atkins
Дата:
Сообщение: Re: Persistent data per connection
Следующее
От: "Jim Buttafuoco"
Дата:
Сообщение: Re: Stuck with references